package threadpool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * ClassName: FixedThreadPoolTest
 * Package: threadpool
 *
 * @Author 马学兴
 * @Create 2024/3/14 0:03
 * @Version 1.0
 * Description:演示newFixedThreadPool
 */
public class FixedThreadPoolOOM {
    private static ExecutorService executorService=Executors.newFixedThreadPool(1);
    public static void main(String[] args) {
        for (int i = 0; i < Integer.MAX_VALUE; i++) {
            executorService.execute(new Task());
        }
    }
    static class Task implements Runnable{

        @Override
        public void run() {
            try {
                Thread.sleep(50000000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
